1. Field of the Invention
Methods and apparatuses consistent with the present invention relate to video coding and decoding, and more particularly, to predicting a motion vector using a global motion vector.
2. Description of the Related Art
Inter-frame and intra-frame predictions are commonly used video encoding technologies. Intra-frame prediction is based on close correlation between gray levels of adjacent pixels in a single frame. Inter-frame prediction is based on similarities between successive frames in a video sequence. If no abrupt change appears in a moving picture screen, most areas of the moving picture do not change between successive frames. In particular, motion vector prediction is a video coding technique used in inter-frame prediction. Motion vector prediction is used to process images by differentially encoding motion vectors calculated by motion prediction. In general, a motion vector of a certain block has a close relationship with motion vectors of partitions adjacent to the block. Accordingly, by predicting a current block using its adjacent partitions and encoding only a difference vector between the current block and the adjacent partitions, it is possible to reduce the amount of bits that are to be encoded.
FIGS. 1A and 1B illustrate adjacent partitions which are used for motion prediction, according to a related art technique.
FIG. 1A shows a case where a current macroblock E and partitions A, B, and C adjacent to the current macroblock E have the same shape and size. In this case, prediction encoding of a motion vector of the current macroblock E is performed using motion vectors of the left block A, the upper block B, and the upper right block C of the current macroblock E, and a median value of the horizontal and vertical components of each motion vector.
FIG. 1B shows a case where a current macroblock E and partitions A, B, and C adjacent to the current macroblock E have different shapes and sizes. In this case, a motion vector of the current macroblock E is predicted by the following method.
(1) If an adjacent partition which is located at the left side of a macroblock E to be encoded is divided into several blocks, a block A which is the uppermost block among the several blocks is used for prediction. Also, if an adjacent partition which is located at the upper side of the macroblock E is divided into several blocks, a block B which is the leftmost block among the several blocks is used for prediction. Thereafter, prediction encoding of a motion vector of the macroblock E is performed using motion vectors of the block A, the block B, and the block C to the upper right of the macroblock E, and a median value of the horizontal and vertical components of each motion vector.
(2) If the macroblock E that is to be encoded is not a square, for example, if the macroblock E is a 16×8 or 8×16 pixel block, a motion vector of the macroblock E is predicted according to the size of a motion compensated block, using the following method, without using any median value.
(i) If the macroblock E that is to be encoded is a 16×8 pixel block, the blocks at the upper side of the macroblock E are predicted using the block B, and the blocks at the lower side of the macroblock E are predicted using the block A.
(ii) If the macroblock E that is to be encoded is an 8×16 pixel block, the blocks at the left of the macroblock E are predicted using the block A, and the blocks to the right of the block E are predicted using the block C.
(3) In the case of a skip macroblock mode, the above case (1) is applied.
As described above, a predicted motion vector (referred to as a “motion vector predictor”) of a current block is defined as a median value of motion vectors of partitions adjacent to the current block. Accordingly, if a current block and its adjacent partition have different motions, a case where the motion vector of the adjacent partition has a Motion Vector Difference (MVD) value greater than that of the actual motion vector of the current block can occur. Accordingly, the amount of bits that are to be encoded can be further increased.